package com.cus.tom.transfer.frag;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.cus.tom.transfer.databinding.DlgLoadingBinding;

public class LoadingDlg extends BaseDialogFragment {

    DlgLoadingBinding binding;
    String msg;

    public LoadingDlg setMsg(String s) {
        if (binding == null) {
            msg = s;
            return this;
        }
        binding.tv.setText(s);
        return this;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DlgLoadingBinding.inflate(inflater, container, false);
        if (!TextUtils.isEmpty(msg)) {
            binding.tv.setText(msg);
            msg = null;
        }
        return binding.getRoot();
    }
}
